package algorithm.poj.p3000;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLDecoder;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.StringTokenizer;


/**
 * 注意一点，每次只能走一步或者两步，所以
 * 1）如果有相邻的格子中有地雷，那么成功跨越雷区的概率是0；
 * 2）跨过一个雷，必须先到达之前的一格，并且下一步要走两步； 
 * 根据这个分析，问题已经很简单了。
 * 
 * 从格子1出发，到达格子k的概率是F(k)，那么F(k) = F(k-1)*p + F(k-2)*(1-p),
 * 其中 F(0) = 0, F(1) = 1。
 * 
 * 进一步求得F(k) = (1-(p-1)^k)/(2-p)
 *  
 * @author wong.tong@gmail.com
 *
 */
public class P3744 {

	public static void main(String[] args) throws Exception {

		InputStream input = null;
		if (false) {
			input = System.in;
		} else {
			URL url = P3744.class.getResource("P3744.txt");
			File file = new File(URLDecoder.decode(url.getPath(), "UTF-8"));
			input = new FileInputStream(file);
		}
		
		BufferedReader stdin = new BufferedReader(new InputStreamReader(input));
		
		StringBuffer sb = new StringBuffer("");
		DecimalFormat df = new DecimalFormat("0.0000000");
		StringTokenizer st = null;
		String line = stdin.readLine();
		while (line != null && line.trim().length() > 0) {
			st = new StringTokenizer(line);
			int N = Integer.valueOf(st.nextToken());
			double p = Double.valueOf(st.nextToken());
			
			st = new StringTokenizer(stdin.readLine());
			int[] ms = new int[N];
			for (int i = 0; i < N; i ++) {
				ms[i] = Integer.valueOf(st.nextToken());
			}
			Arrays.sort(ms);
			sb.append(df.format(calc(p, ms))).append("\n");
			line = stdin.readLine();
		}
		sb.deleteCharAt(sb.length()-1);
		System.out.print(sb);
	}

	private static double calc(double p, int[] ms) {

		for (int i = 1; i < ms.length; i ++) {
			if (ms[i] == ms[i-1]+1 ) return 0f;
		}
		
		float q = 1.0f;
		q *= (1.0-Math.pow(p-1.0, ms[0]-1));
		for (int i = 1; i < ms.length; i ++) {
			q *= (1.0-Math.pow(p-1.0, ms[i]-ms[i-1]-1));
		}
		q *= Math.pow((1.0-p)/(2.0-p), ms.length);
		return q;
	}
}